package com.ht.interfaces.request.link;

import cn.hutool.json.JSONObject;
import com.ht.api.db.Db;
import com.ht.api.db.Entity;
import com.ht.api.db.annotate.*;
import com.ht.api.db.bean.DataResult;
import com.ht.api.db.bean.SessionBean;
import com.ht.api.db.enums.Param;
import com.ht.api.db.request.IHandleRequest;
import com.ht.api.db.util.HtUtil;
import com.ht.interfaces.utils.CallTestUtil;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@FuncId("1912827729099755520")
@FuncGroup("H5接口")
@FuncParams({
	@FuncParam(name = "商品ID", code = "product_link_id", value = "1914147396011560960"),
})

@FuncCall
@FuncName("插件商品详情查询")
public class ProductInfoToPlug implements IHandleRequest {

	@Override
	public void execute(SessionBean me, JSONObject param, DataResult result) {
		Entity product = Db.createSqlParser("product_link").findById(me.getDataSource(), param.get("product_link_id"));

		result.set("title", product.get("title"));
		result.set("img", product.get("img"));
		result.set("link", product.get("link"));
	}

	public static void main(String[] args) throws Exception {

//		CallTestUtil.saveFunc(ProductInfoToPlug.class);


		JSONObject result = CallTestUtil.autoTest(new Object(){}.getClass().getEnclosingClass().getSimpleName());
//		CallTestUtil.createResult("ProductInfoToPlug", result);
	}
}
